package com.example.elliot.pphone;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

    private Button button;
    private EditText editText;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        button = (Button) this.findViewById(R.id.button);
        editText = (EditText) this.findViewById(R.id.editText);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String tel_number = editText.getText().toString();
                Intent intent = new Intent();
                //intent.setAction("android.intent.action.CALL");
                intent.setData(Uri.parse("tel:" + tel_number));
                startActivity(intent);
            }
        });


    }
}
